
import { useDispatch } from "react-redux"
import { setToken } from "@/store/TokenStore"
import { getCurrentInstance } from '@tarojs/taro';
import { setTokenLocal } from "@/untils";
import { useEffect } from "react";
const useSetToken = ()=>{
    const dispatch = useDispatch()
    const instance = getCurrentInstance();
    const token = instance.router?.params.token ?? ''
    useEffect(()=>{
        dispatch(setToken(token))
        setTokenLocal(token)
    },[token])
}


export default useSetToken